home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 November
/
Ahoy_Magazine_85-11_1985_Double_L.d64
/
knight's tour
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
68 lines
100 rem * knight's tour / commodore 64 / ramella
101 poke 53280,0: poke 53281,0
102 print "[147][150]": v=53248: poke v+34,4: poke 53269,4: poke 2042,13
103 for n=0 to 62: read a: poke 832+n,a: next: l=53: h=28
105 print"";spc(33);"knight": print: print spc(33);"tour": print ""
106 print: print: print: print: print "":print spc(33);"score:": print "";
107 print ""
110 t$="[207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][180]"
112 n$="[180] [180] [180] [180] [180] [180] [180] [180] [180]"
115 for x=1 to 8: print t$: print n$: print n$: next
116 print"[145][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175]"
120 gosub 5000
150 geta$: if a$<>"a" and a$<>"z" and a$<>"," and a$<>"." and a$<>"k" then 150
152 if a$="k" then 245
155 if h=252 and a$="." then 150
160 if a$="." then for h=h to h+32 step 4
165 if h=28 and a$="," then 150
170 if a$="," then for h=h to h-32 step -4
175 if l=221 and a$="z" then 150
180 if a$="z" then for l=l to l+24 step 2
185 if l=53 and a$="a" then 150
190 if a$="a" then for l=l to l-24 step -2
200 gosub 5000: next
210 if a$="." then h=h-4: p=p+4
220 if a$="," then h=h+4: p=p-4
230 if a$="z" then l=l-2: p=p+120
235 if a$="a" then l=l+2: p=p-120
240 goto 150
245 s$="": h1=h: l1=l: p1=p
250 get a$: if a$<>"a" and a$<>"z" and a$<>"," and a$<>"." then 250
252 s$=s$+a$
255 if h=252 and a$="." then 385
260 if a$="." then for h=h to h+32 step 4
265 if h=28 and a$="," then 385
270 if a$="," then for h=h to h-32 step -4
275 if l=221 and a$="z" then 385
280 if a$="z" then for l=l to l+24 step 2
285 if l=53 and a$="a" then 385
290 if a$="a" then for l=l to l-24 step -2
300 gosub 5000: next
310 if a$="." then h=h-4: p=p+4
320 if a$="," then h=h+4: p=p-4
330 if a$="z" then l=l-2: p=p+120
335 if a$="a" then l=l+2: p=p-120
337 if len(s$)=3 then 350
340 goto 250
350 if s$="aa." or s$=".aa" or s$="a.." or s$="..a" or s$="..z" then w=1
360 if s$="z.." or s$="zz." or s$=".zz" or s$="zz," or s$=",zz" then w=1
370 if s$=",,z"or s$="z,,"or s$=",,a"or s$="a,,"or s$="aa,"or s$=",aa"then w=1
375 if peek(1024+p)=81 then 385
380 if w=1 then w=0: goto 400
385 p=p1: h=h1: l=l1: gosub 5000: w=0: goto 245
390 goto 245
400 for g=p to p+80 step 40: for r=g to g+3
410 poke 1024+r,81: poke 55296+r,14: next r,g
411 tl=tl+1: tl$=str$(tl): for jf=2 to len(tl$)
412 poke 1537+jf,asc(mid$(tl$,jf,1)): next jf
420 goto 245
5000 poke v+4,h: poke v+5,l: return
10000 data 0,31,128,0,255,224,1,255,240
10010 data 3,255,248,7,231,254,15,255,252
10020 data 31,255,252,63,255,255,127,255,252
10030 data 255,255,254,255,255,255,127,159,252
10040 data 60,15,254,0,31,255,0,31,252
10050 data 0,63,254,0,255,255,1,255,252
10060 data 7,255,254,31,255,255,63,255,255
10070 end